package entities;

public class Course {

	private String ID;
	private int duration;
	private int capacity;
	private String zone;
	private String instructor;

	private String campus;
	private String usage;
	private String nature;

	private String assigned_crm;

	private int index_w;
	private int index_t;
	private int count;
	private int priority;

	public Course() {
		index_w = 0;
		index_t = 0;
		count = 0;
		priority = 0;
	}

	public Course(String Id, int d, int c, String i) {
		this.ID = Id;
		this.duration = d;
		this.capacity = c;
		this.instructor = i;
	}

	public void set_assigned_crm(String r) {
		this.assigned_crm = r;
	}

	public String get_assigned_crm() {
		return this.assigned_crm;
	}

	public void set_index_w(int w) {
		this.index_w = w;
	}

	public int get_index_w() {
		return this.index_w;
	}

	public void set_count(int c) {
		this.count = c;
	}

	public int get_count() {
		return this.count;
	}

	public void set_index_t(int t) {
		this.index_t = t;
	}

	public int get_index_t() {
		return this.index_t;
	}

	public void set_ID(String d) {
		this.ID = d;
	}

	public String get_ID() {
		return this.ID;
	}

	public void set_duration(int d) {
		this.duration = d;
	}

	public int get_duration() {
		return this.duration;
	}

	public void set_zone(String z) {
		this.zone = z;
	}

	public String get_zone() {
		return this.zone;
	}

	public void set_capacity(int c) {
		this.capacity = c;
	}

	public int get_capacity() {
		return this.capacity;
	}

	public void set_instructor(String i) {
		this.instructor = i;
	}

	public String get_instructor() {
		return this.instructor;
	}
	
	public void set_priority(int c) {
		this.priority = c;
	}

	public int get_priority() {
		return this.priority;
	}

	public String checkWeek(int w) {
		switch (w) {
		case 1:
			return "Mon";
		case 2:
			return "Tue";
		case 3:
			return "Wed";
		case 4:
			return "Thu";
		case 5:
			return "Fri";
		default:
			return "ERROR";
		}
	}

	public String checkStartTime(int t) {
		switch (t) {
		case 1:
			return "0900 ";
		case 2:
			return "1000 ";
		case 3:
			return "1100 ";
		case 4:
			return "1200 ";
		case 5:
			return "1300 ";
		case 6:
			return "1400 ";
		case 7:
			return "1500 ";
		case 8:
			return "1600 ";
		case 9:
			return "1700 ";
		case 10:
			return "1800 ";
		case 11:
			return "1900 ";
		default:
			return "ERROR ";
		}
	}

	public String checkEndTime(int t) {
		switch (t) {
		case 1:
			return "- 1000";
		case 2:
			return "- 1100";
		case 3:
			return "- 1200";
		case 4:
			return "- 1300";
		case 5:
			return "- 1400";
		case 6:
			return "- 1500";
		case 7:
			return "- 1600";
		case 8:
			return "- 1700";
		case 9:
			return "- 1800";
		case 10:
			return "- 1900";
		case 11:
			return "- 2000";
		default:
			return "- ERROR";
		}
	}

	@Override
	public String toString() {
		return "Course: " + this.ID + "	Room: " + this.assigned_crm + "	"
				+ checkWeek(this.index_w) + "	Duration : " + this.duration + "	"
				+ checkStartTime(this.index_t)
				+ checkEndTime(this.index_t + this.count - 1) + "	"
				+ this.instructor;
	}

	@Override
	public boolean equals(Object obj) {
		// TODO Auto-generated method stub
		if (obj instanceof Course) {
			Course c = (Course) obj;
			if (this.ID.equals(c.ID) && this.duration == c.duration
					&& this.capacity == c.capacity
					&& this.instructor.equals(c.instructor))
				return true;
		}
		return false;

	}

	/*
	 * @Override public int hashCode() { // TODO Auto-generated method stub
	 * return super.hashCode(); }
	 */

}